{% extends "base.html" %}

{% block head %}
    <title>index</title>
{% endblock %}

{% block body %}
    <div style="margin: 20px">
    {% if session.get('user') %}
        <div id="sidebar">
            <div class="panel">
                <div class="inner. no-padding">
                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
                        <tr>
                            <td width="58"><a href='{{ url_for('member.user', name=session['user']) }}'>
                                <img src={{ session['img'] }}
                                     class="avatar" border="0" align="default"
                                     style="max-width: 48px; max-height: 48px;"/></a></td>
                            <td width="10"></td>
                            <td width="auto"><a href='{{ url_for('member.user', name=session['user']) }}'><h3>{{ session.user }}</h3></a></span>
                            </td>
                        </tr>
                    </table>
                    <div class="sep10"></div>
                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
                        <tr>
                            <td width="34%"
                                style="border-left: 1px solid rgba(100, 100, 100, 0.4); border-right: 1px solid rgba(100, 100, 100, 0.4);"
                                align="center"><a href="/my/topics" class="dark" style="display: block;"><span
                                    class="bigger">0</span>
                                <div class="sep3"></div>
                                <h5>主题收藏</h5></a></td>
                            <td width="33%" align="center"><a href="/my/following" class="dark" style="display: block;"><span
                                    class="bigger">0</span>
                                <div class="sep3"></div>
                                <h5>特别关注</h5></a></td>
                        </tr>
                    </table>
                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
                        <tr>
                            <td width="32"><a href="/new"><img
                                    src="/static/img/flat_compose.png" width="48"
                                    border="0"/></a></td>
                            <td width="10"></td>
                            <td width="auto" valign="middle" align="left"><a href='{{ url_for('wen.new') }}'><h4>创作新主题</h4></a></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    {% else %}
        <div id="sidebar">
            <div class="panel">
                <div class="inner. no-padding">
        <div class="box">
                        <div class="cell">
                            <strong>V2EX = way to explore</strong>
                            <div class="sep5"></div>
                            <span >V2EX 是一个关于分享和探索的地方</span>
                        </div>
                        <div class="inner">
                            <div class="sep5"></div>
                            <div align="center">
                                <a style="color: white" href="{{ url_for('member.register') }}" type="button" class="btn btn-default">现在注册</a>
                            <div class="sep5"></div>
                            <div class="sep10"></div>
                            已注册用户请 &nbsp;<a href='{{ url_for('member.login') }}'>登录</a></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    {% endif %}

        <div id="Main" style="margin: 0px 310px 0px 20px">

            <div class="sep20"></div>

            <div class="panel" style="padding: 0px 0px 0px 0px;">
                <div class="inner"
                     style="background-color: #fff; border-top-left-radius: 3px; border-top-right-radius: 3px;"
                     id="Tabs">
                    <a href="/?tab=tech" class="span-common">技术</a>

                    <a href="/?tab=jobs" class="span-common">酷工作</a>

                    <a href="/?tab=city" class="span-common">城市</a>
                    <div class="cell" style="background-color: #f9f9f9; padding: 10px 10px 10px 20px;">

                        {% for t in tags %}
                            <a href='{{ url_for('wen.index', name=t.name) }}'>
                                {{ t.chinese }}</a>&nbsp; &nbsp;
                        {% endfor %}
                    </div>

                    {% for blog, reply_c in blog_list %}
                        <div class="cell">
                            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                <tr>

                                    <td width="38" valign="top" align="center">
                                        <a href='{{ url_for('member.user', name=blog.author.username) }}'>
                                            <img width="58" src='{{ blog.author.img_url }}'/></a></td>
                                    <td width="10"></td>

                                    <td width="auto" valign="middle">
        <span class="item_title">
            <h4><a href='{{ url_for('wen.blog', id=blog.id) }}'>{{ blog.title }}<br></a></h4>
        </span>
                                        <div class="sep5"></div>
                                        <a class="node"
                                           href='{{ url_for('wen.index', name=blog.tag) }}'>{{ blog.tag }}</a>
                                        &nbsp;•&nbsp; <strong>
                                        <a href='{{ url_for('member.user', name=blog.author.username) }}'>{{ blog.author.username }}</a></strong>

                                    </td>

                                    <td width="70" align="left" valign="left">
                                        <span style="color: #2d6987">{{ reply_c }}个回复</span></a>

                                    </td>
                                </tr>
                            </table>
                        </div>
                    {% endfor %}

                </div>
            </div>
        </div>
    </div>
{% endblock %}